/*
 * @Author: pengtianrui 2276608413@qq.com
 * @Date: 2024-07-24 19:37:27
 * @LastEditors: Wang Shuo wangshuo@sgsimulation.com
 * @LastEditTime: 2024-08-30 13:55:29
 * @FilePath: \SGFEM\DataStructure\FEM\Element\include\CQUAD4Data.h
 * @Description:定义等参膜，弯曲或平面应变四边形板单元
 * CQUAD4
 */
#pragma once
#include "DataStructure/Common/DataStructureNamespace.h"
#include "DataStructure/Common/Id.h"
#include "DataStructure/Common/Real.h"
#include "DataStructure/Input/Element/ElementBase.h"

SG_DATASTRUCTURE_FEM_NAMESPACE_OPEN
struct DECLSPEC CQUAD4Data : public ElementBase
{
    /** @brief 确定单元是否具有厚度属性 */
    bool IsVariationalThickness () const;

    /** */
    std::vector<SG::DataStructure::Common::Real> ComputeShellThick (bool isComposite, SG::DataStructure::Common::Real tp) const;

    /** @brief 获得单元节点厚度
     * @param tp pshell 中的厚度值
     * @param [out] 节点厚度值，可以传入一个 长度为 4 的数组
     */
    void GetThickness (SG::DataStructure::Common::Real tp, SG::DataStructure::Common::Real* tNodes) const;

    SG::DataStructure::Common::Id   m_pId      = 0;                           ///< property's id
    SG::DataStructure::Common::Id   m_g[4]     = { 0 };                       ///< nodes' id
    SG::DataStructure::Common::Real m_theta    = 0.0;                         /// 材料属性方向角度
    SG::DataStructure::Common::Real m_zoffs    = 0.0;                         /// 从网格点的表面偏移到元素参考平面
    SG::DataStructure::Common::I64  m_tflag    = 0;                           /// 表示Ti值的含义
    SG::DataStructure::Common::Real m_ti[4]    = { -1.0, -1.0, -1.0, -1.0 };  /// 单元膜厚度
    SG::DataStructure::Common::Id   m_mcId     = -1;                          /// 材料坐标系号
    SG::DataStructure::Common::Id   m_domainId = 0;
};

/// @brief 判断两个CQUAD4Data是否相等
/// @param a
/// @param b
/// @return
DECLSPEC bool operator== (const CQUAD4Data& a, const CQUAD4Data& b);

SG_DATASTRUCTURE_FEM_NAMESPACE_CLOSE